from django.urls import path, include
from app01.views import (UserView,
                         UserDetailView,
                         LoginAPIView,
                         ArticleView,
                         ArticleDetailView,
                         ArticleTagView,
                         ArticleTagDetailView,
                         TagView,
                         TagDetailView,
                         CommentView,
                         YourView)

from rest_framework import routers

router = routers.DefaultRouter()

# router.register(r'user', UserView)
# router.register(r'article', ArticleView)
# router.register(r'article_tag', ArticleTagView)
# router.register(r'tag', TagView)
router.register(r'comment', CommentView)

urlpatterns = [
    path('api/', include(router.urls)),
    path("api/user/", UserView.as_view()),
    path("api/user/<int:pk>/", UserDetailView.as_view()),
    path('api/login/', LoginAPIView.as_view(), name='user-login'),
    path("api/article/", ArticleView.as_view()),
    path("api/article/<int:pk>/", ArticleDetailView.as_view()),
    path("api/tag/", TagView.as_view()),
    path("api/tag/<int:pk>/", TagDetailView.as_view()),
    path("api/article_tag/", ArticleTagView.as_view({"get": "get_article_tag", "post": "create"})),
    path("api/article_tag/<int:pk>/", ArticleTagDetailView.as_view({"get": "get", "put": "put", "delete": "delete"})),
]
